package com.lkm.app_ui;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;


public class BootReceiver extends BroadcastReceiver {
    public void onReceive(final Context context, Intent intent) {

        BootReceiver.startApp(context, context.getPackageName());
    }

    public static void startApp(Context context, String packageName) {
        try {
            Intent it = context.getPackageManager().getLaunchIntentForPackage(packageName);
            it.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(it);
        } catch (Throwable e) {
        }
    }

    public static void goHome(Context context) {
        Intent intent = new Intent();
        
        intent.setAction(Intent.ACTION_MAIN);// "android.intent.action.MAIN"
        intent.addCategory(Intent.CATEGORY_HOME); //"android.intent.category.HOME"
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
    }
}
